<?php
$file_url = "http://www.youku.com/v_olist/c_97.html";
//$file_url = "http://tudou.com";
$data = gethtml($file_url);
$match = preg_replace('/http:\/\/www.youku.com\//i','http://tv.cn/',$data);
//preg_match_all('/<div class="headerBox">(.*)<!--headerBox end-->/is',$data,$match);
$match = preg_replace('/<script type="text\/javascript" src="([^<>]*).js"><\/script>/is',' ',$match);
$match = preg_replace('/<script type="text\/javascript">([^<>]*)<\/script>/is',' ',$match);
$match = preg_replace('/<div class="headerBox">(.*)<!--headerBox end-->/is','',$match);
$match = preg_replace('/<div class="footerBox">(.*)<!--footeBox end-->/is','',$match);
$match = preg_replace('/<div id="browse_popularize" class="popularize">(.*)<div class="s_body">/is','<div class="s_body">',$match);
$match = preg_replace('/<div class="box_border cooperation">(.*)<!--center end-->/is','</div>',$match);
echo $match;die;
function gethtml($url)
{
	$surl = "http://www.youku.com/";
	$cookie_file = dirname(__FILE__)."/temp/youku.txt";
	$ch = curl_init();
	  curl_setopt($ch, CURLOPT_URL, $url);
	  curl_setopt($ch, CURLOPT_REFERER, $surl);
	  curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
	  curl_setopt($ch, CURLOPT_HEADER, 0);
	  curl_setopt($ch, CURLOPT_NOBODY, 0);
	  curl_setopt($ch, CURLOPT_TIMEOUT, 60);
	  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // 允许自动跳转
	  curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
	  //curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
	  $contents = curl_exec($ch);
	  curl_close($ch);
	  return $contents;
}
?>